package com.ffsky.template.demo.app;

import android.os.Bundle;

import androidx.appcompat.app.AppCompatActivity;

import com.ffsky.template.demo.R;
import com.ffsky.template.demo.jsapi.JsApi;
import com.ffsky.template.demo.jsapi.JsEchoApi;
import com.gitee.hljdrl.dsbridge.DSWebView;


public class JsToNativeActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_js_call_native);
        final DSWebView webView=  findViewById(R.id.webview);
        // set debug mode
        DSWebView.setWebContentsDebuggingEnabled(true);
//        dwebView.addJavascriptObject(new JsApi(), null);
//        dwebView.addJavascriptObject(new JsEchoApi(),"echo");
        webView.addDSPlugin("echo", JsEchoApi.class);
        webView.addDSPlugin(null, JsApi.class);
        webView.loadUrl("file:///android_asset/js-call-native.html");
    }
}
